package com.refactor.practice;

import com.refactor.practice.strategy.ChildrenChargeStrategy;
import com.refactor.practice.strategy.IStrategy;
import com.refactor.practice.strategy.NewReleaseChargeStrategy;
import com.refactor.practice.strategy.RegularChargeStrategy;

public class Movie {

	public static final int REGULAR = 0;
	public static final int NEW_RELEASE = 1;
	public static final int CHILDRENS = 2;
	private String _title;
	private int _priceCode;

	private IStrategy strategy;

	public Movie(String title, int priceCode) {
		_title = title;
		_priceCode = priceCode;
	}

	public String getTitle() {
		return _title;
	}

	public int getPriceCode() {
		return _priceCode;
	}

	public void setPriceCode(int _priceCode) {
		this._priceCode = _priceCode;
	}

	public IStrategy getStrategy() {
		switch (_priceCode) {
			case Movie.NEW_RELEASE:
				strategy = new NewReleaseChargeStrategy();
				break;
			case Movie.CHILDRENS:
				strategy = new ChildrenChargeStrategy();
				break;
			default:
				strategy = new RegularChargeStrategy();
		}
		return strategy;
	}
}
